package kaindorfcompany.webshop.productmanagement.backend.data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

public class Ingredient {

    private int id;

    @NotNull
    private String designation;

    @NotNull
    private String unit;

    @NotNull
    @Min(1)
    @Max(500000)
    private int amount;

    public Ingredient(String designation, String unit, int amount) {
        this(0, designation, unit, amount);
    }

    public Ingredient(int id, String designation, String unit, int amount) {
        this.id = id;
        this.designation = designation;
        this.unit = unit;
        this.amount = amount;
    }

    public Ingredient(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getDesignation() {
        return designation;
    }

    public void setDesignation(String designation) {
        this.designation = designation;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }
    
    

    // public String toSimpleHTMLString() {
    // return String.format("<tr><td>%d</td><td>%s</td><td>%s<td><td>%d</td></tr>", id, designation, unit, amount);
    // }

    @Override
    public String toString() {
        return "Ingredient{" + "id=" + id + ", designation=" + designation + ", unit=" + unit + ", amount=" + amount + '}';
    }
}
